<template>
    <div>
        {{key}}
        <div class="border">

            <componentKey :key="key" />
            刷新子组件
        </div>

        <div @click="key+=1">刷新key</div>
    </div>
</template>

<script>
    import componentKey from "./componentKey";
    export default {
        components: {
            componentKey
        },
        data() {
            return {
                key: 1,
            };
        },
    };
</script>

<style lang="less" scoped>
    .border {
        border: 1px solid red;
    }
</style>